<script>
export default {
  props: {
    goods: Array,
  },
  computed: {
    totalPrice() {
      let t = this.goods.reduce( (prev, curr) => prev + curr.price * curr.amount, 0 );
      return t.toFixed(2);
    }
  }
};
</script>

<template>
    <div class="total">
       <span>{{totalPrice}}</span>
    </div>
</template>

<style>
.total {
    display: flex;
    margin: 10px;
    flex-direction: row-reverse;
}

.total>span {
    flex-basis: 15%;
    text-align: center;
}
</style>
